package com.ctgu.j08.controller;

import com.ctgu.j08.service.RepairService;
import com.ctgu.j08.vo.Repair;
import com.ctgu.j08.vo.Result;
import com.ctgu.j08.vo.Trouble;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @version 1.0
 * @author: Saiya Wang
 * @date: 2021/6/3 10:18
 */
@Controller
@RequestMapping("/repair")
public class RepairController {
    @Autowired
    private RepairService repairService;


    @PostMapping("/add")
    @ApiOperation("添加维修信息")
    @ResponseBody
    public Result addRepair(@RequestBody Repair repair){
        System.out.println("添加的维修信息"+repair);
        return repairService.addRepair(repair);
    }

    @GetMapping("/getAll")
    @ApiOperation("获取全部维修信息")
    @ResponseBody
    public Result getAllRepairInfo()
    {
        return repairService.getAllRepairInfo();
    }

    @PutMapping("/edit")
    @ApiOperation("更新维修信息")
    @ResponseBody
    public Result editRepair(@RequestBody Repair repair)
    {
        return repairService.editRepair(repair);
    }

}
